home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-02-09 | 13.1 KB | 470 lines | [TEXT/MPS ] |
- #
- # v.Verify
- #
- # 12/11/92
- # Kerry Laidlaw
- # Apple Computer, Inc.
- #
- # Function:
- # Compare two disks or folders, file by file, all the resources and data
- # forks. Also compare the file attributes too. Generate a report showing
- # the differences between the two disks or folders. The report lists the
- # differences file by file.
- #
- #
-
- # Save some initial shell variable values, and set them for our own use
-
- set saveExit {exit}
- set exit 0 # Set exit 0 so we won't abort if status variable is non-zero
- set saveEcho {echo} # echo=1 for echoing each command before execution
- set echo 0
- set saveDir `directory`
-
- set UseFileList "off"
-
- for theParameter in {"Parameters"}
- if "{theParameter}" == "-name"
- shift 1
- set UserName "{1}"
- else if "{theParameter}" == "-productname"
- shift 1
- set ProductName "{1}"
- else if "{theParameter}" == "-reportfolder"
- shift 1
- set ReportFolder "{1}"
- if `evaluate "{ReportFolder}" =~ /:(≈)®1/`
- set ReportFolder "{®1}"
- set ReportFolder "`directory -q`""{ReportFolder}"
- end
- else if "{theParameter}" == "-master"
- shift 1
- set MasterFolder "{1}"
- if `evaluate "{MasterFolder}" =~ /:(≈)®1/`
- set MasterFolder "{®1}"
- set MasterFolder "`directory -q`""{MasterFolder}"
- end
- else if "{theParameter}" == "-test"
- shift 1
- set TestFolder "{1}"
- if `evaluate "{TestFolder}" =~ /:(≈)®1/`
- set TestFolder "{®1}"
- set TestFolder "`directory -q`""{TestFolder}"
- end
- else if "{theParameter}" == "-filelist"
- shift 1
- set FileList "{1}"
- if `evaluate "{FileList}" =~ /:(≈)®1/`
- set FileList "{®1}"
- set FileList "`directory -q`""{FileList}"
- end
- else if "{theParameter}" == "-rnames"
- shift 1
- set rNamesFolder "{1}"
- if `evaluate "{rNamesFolder}" =~ /:(≈)®1/`
- set rNamesFolder "{®1}"
- set rNamesFolder "`directory -q`""{rNamesFolder}"
- end
- else if "{theParameter}" == "-usefilelist"
- shift 1
- set UseFileList "on"
- else if "{theParameter}" == "-countryCode"
- shift 1
- set countryCodeDefault "{1}" # remember the pop-up for next time
- export countryCodeDefault
- (evaluate "{1}" =~ /?(??)®1≈/) >dev:null
- (evaluate "{1}" =~ /????(??)®2≈/) >dev:null
- set LangInt "{®1}"
- if `evaluate "{LangInt}" =~ / (≈)®1/`
- set LangInt "{®1}"
- end
- set LangCode "{®2}"
- if `evaluate "{LangCode}" =~ /(?)®2 ≈/`
- set LangCode "{®2}"
- end
- else
- shift 1
- end
- end
-
- if `exists -d "{ReportFolder}"`
- set ReportFile "{ReportFolder}""{ProductName}".rpt
- if "{UseFileList}" == "off"
- set FileList "{ReportFolder}""{ProductName}".lst
- end
- else
- set ReportFile "`directory -q`""{ProductName}".rpt
- if "{UseFileList}" == "off"
- set FileList "`directory -q`""{ProductName}".lst
- end
- end
-
- # Let the other scripts use the input parameters
-
- Export UserName
- Export ProductName
- Export ReportFile
- Export MasterFolder
- Export TestFolder
- Export FileList
- Export rNamesFolder
- Export LangCode
- Export LangInt
-
- #echo filelist- "{FileList}"
- #echo rnames- "{rNamesFolder}"
- #echo username- "{UserName}"
- #echo productname- "{ProductName}"
- #echo reportfile- "{ReportFile}"
-
- # Now update user defaults file with any new values user entered
- set DefaultStringsFile "{mpw}"scripts:V.DefaultStrings
- target "{DefaultStringsFile}"
-
- find 1
- if ("`catenate §`" == "•No Default•")
- replace 1 "{UserName}"∂n
- end
- find 2
- if ("`catenate §`" == "•No Default•")
- replace 2 "{ProductName}"∂n
- end
- find 3
- if ("`catenate §`" == "•No Default•")
- replace 3 "{rNamesFolder}"∂n
- end
- find 4
- if ("`catenate §`" == "•No Default•")
- replace 4 "{MasterFolder}"∂n
- end
- find 5
- if ("`catenate §`" == "•No Default•")
- replace 5 "{TestFolder}"∂n
- end
- find 6
- if ("`catenate §`" == "•No Default•")
- replace 6 "{ReportFolder}"∂n
- end
- find 7
- if ("`catenate §`" == " 1/F - France")
- replace 7 "{countryCodeDefault}"∂n
- end
- find 8
- if ("`catenate §`" == "•No Default•")
- replace 8 "{FileList}"∂n
- end
-
-
- close -y # Save the changes to the default file
-
- if ( ∂
- ("{UseFileList}" == "off") ∂
- && ∂
- ( ∂
- ("{MasterFolder}" == "•No Default•") || ∂
- ("{TestFolder}" == "•No Default•") || ∂
- ("{ReportFolder}" == "•No Default•") || ∂
- ("{rNamesFolder}" == "•No Default•") ∂
- ) ∂
- ) ∂
- || ∂
- ( ∂
- ("{UseFileList}" == "on") ∂
- && ∂
- ( ∂
- ("{FileList}" == "•No Default•") || ∂
- ("{ReportFolder}" == "•No Default•") || ∂
- ("{rNamesFolder}" == "•No Default•") ∂
- ) ∂
- )
- alert "You must supply a parameter where ever you see:∂n∂n∂t∂t∂t∂t∂t∂t∂t∂t∂t∂t∂t∂t∂t∂"•No Default•∂"∂n∂n∂
- Please select the ∂"Create Report...∂" menu item again."
-
- exit 2
- end
-
- if "{ProductName}" !~ /?«1,23»/
- alert "The Product Name must be 23 characters or less.∂n∂n∂
- Please select the ∂"Create Report...∂" menu item again and edit the Product Name."
- exit 2
- end
-
- # Now lets make sure all files are decompressed (Type = 'splt',Creator = 'csw2')
-
- set tempDir `directory`
-
- directory "{MasterFolder}" # Decompress all files in the Master Folder
- For aFile in `Files -f -r`
- if `exists -f "{aFile}"`
- decompressIt "{aFile}"
- end
- end
-
- directory "{TestFolder}" # Decompress all files in the Test Folder
- For aFile in `Files -f -r`
- if `exists -f "{aFile}"`
- decompressIt "{aFile}"
- end
- end
-
- directory "{tempDir}" # Leave the directory setting unchanged
-
- if "{UseFileList}" == "off"
- set i 1
- loop
- new "{FileList}" ≥ dev:null # ignore errors, since we handle them ourself
- set saveStatus {status}
- if {saveStatus} == 0 # Successfully created
- break
- else if {saveStatus} == 2 # File already exists, append a numeric suffix
- if `evaluate "{FileList}" =~ /(≈)®1[.][0-9]+/`
- set FileList "{®1}"."{i}"
- else
- set FileList "{FileList}"."{i}"
- end
- set i `evaluate {i} + 1`
- else
- echo "Creation of the File List ∂"{filelist}∂" failed." >> "{ReportFile}"
- echo "Creation of the File List ∂"{filelist}∂" failed." >> "{WorkSheet}"
- exit # Can't continue.
- end
- end
-
- # Now go create the filelist
-
- v.filelist ≥≥ "{Worksheet}" # Send any diagnostic error messages to the users worksheet
-
- else # make sure the filelist file exists
- if !`exists "{FileList}"`
- alert "Your selected file list is missing: ∂n∂n∂"{FileList}∂"∂n∂nSelect another, or uncheck the File List option."
- set echo {saveEcho} # restore echo
- set exit "{saveExit}"
- exit 2
- end
- end
-
- # A new report file is always created. If the file already exists, then add a numeric suffix.
- set i 1
- loop
- new "{ReportFile}" ≥ dev:null # ignore errors, since we handle them ourself
- set saveStatus {status}
- if {saveStatus} == 0 # Successfully created
- break
- else if {saveStatus} == 2 # File already exists, append a numeric suffix
- if `evaluate "{ReportFile}" =~ /(≈)®1[.][0-9]+/`
- set ReportFile "{®1}"."{i}"
- else
- set ReportFile "{ReportFile}"."{i}"
- end
- set i `evaluate {i} + 1`
- else
- echo "Creation of the Report File ∂"{ReportFile}∂" failed." >> "{ReportFile}"
- echo "Creation of the Report File ∂"{ReportFile}∂" failed." >> "{WorkSheet}"
- exit # Can't continue.
- end
- end
-
- open "{FileList}"
- set saveStatus {status}
- if {saveStatus} != 0 # Successfully created
- alert "Could not open File List file: ∂"{FileList}∂". Please generate a new File List, ∂
- and create the report again."
- set echo {saveEcho} # restore echo
- set exit "{saveExit}"
- exit 2
- end
-
- open "{ReportFile}"
- if {saveStatus} != 0 # Successfully created
- echo "Could not open Report file: ∂"{ReportFile}∂"" >> "{ReportFile}"
- echo "Could not open Report file: ∂"{ReportFile}∂"" >> "{WorkSheet}"
- alert "Could not open Report file: ∂"{ReportFile}∂". Select a new directory for the report, ∂
- and create the report again."
- set echo {saveEcho} # restore echo
- set exit "{saveExit}"
- exit 2
- end
-
- TileWindows
-
- # First off, lets verify the filelist file contents are ok.
-
- find • "{filelist}" # Move to the beginning of the file list window
- set nLines `count -l "{filelist}"` # Get the number of lines in the filelist file
- # if file is not empty, and has an even number of lines then we are Ok
- if (`evaluate "{nLines}"` >= 2) && !(`evaluate "{nLines}"` & 1)
- set NumberOfLinesOk TRUE
- else
- set NumberOfLinesOk FALSE
- end
-
- # Get the filenames from the file list file and make sure they exist
-
- set FileMissing FALSE
- loop
- find /•≈∞/ "{filelist}" # Get a line from filelist.
- break if `count -l "{filelist}.§"` == 0 # Exit loop if end.
- set aFile "`catenate "{filelist}.§"`"
- if !`exists "{aFile}"`
- set FileMissing TRUE
- break
- end
- end
-
- if (NumberOfLinesOk == FALSE) || (FileMissing == TRUE)
- alert "Cannot find files described in File List. Please generate a new File List, ∂
- and restart the command from the menu."
- set echo {saveEcho} # restore echo
- set exit "{saveExit}"
- exit 2
- end
-
- # Create the header of the report:
-
- (
- echo "Using Verifier Version" "{VerifierVersion}"
- echo "============================================================================"
- echo "Product: {ProductName}"
- echo "Report Date: `date`"
- echo "From: {UserName}"
- echo
- echo "Verified by:"
- echo
- ) > "{ReportFile}" # Clear previous data (if any) and write out the header
-
-
- # Now list the files that will be verified in the report header:
-
- echo "Files Verified:" >> "{ReportFile}"
-
- # Now let's list the filenames in the header of the report
- # Loop on the filenames from the filelist.
-
- Find • "{filelist}" # Move to the beginning of the file list window
-
- set loopEnd `evaluate {nLines} DIV 2`
- set loopIndex 1
-
- loop
-
- # Get the US names from the filelist and list them for reference
- find /•≈∞/ "{filelist}" # Get a line from filelist.
-
- set USfile "`catenate "{filelist}.§"`"
-
- # Now we have the full pathname of the file, let's strip off the path info
- # and output just the filename to the Verifier report header
- (evaluate "{USfile}" =~ /([¬:]+:)*(≈)®1/) > dev:null
- set USfilename "{®1}"
-
- echo -n "{USfilename}"
- versShow "{USfile}"
-
- # Skip the localized name from the filelist.
- find /•≈∞/ "{filelist}" # Get the next line from filelist.
-
- if {loopIndex} % 4 == 0 # Display 4 file names per line
- echo ", "
- else if {loopIndex} != {loopEnd}
- echo -n ", " # Add a comma after each filename
- end
- break if {loopIndex} == {loopEnd} # Exit loop if end
- set loopIndex `Evaluate {loopIndex} + 1` # Increment my loop counter
-
- end >> "{ReportFile}" # End of loop on the files in the correspondence filelist.
-
- (
- echo
- echo
- echo "The items marked with ••• need be corrected or justified before GM release."
- echo "Additional comments, indicated with '==>' are for your information only."
- echo
- ) >> "{ReportFile}"
-
- # End of header
-
- (
- echo " Using filelist:" "{filelist}"
- echo "Using rNames folder:" "{rNamesFolder}"
- echo "============================================================================"
- echo
- ) >> "{ReportFile}"
-
- # Compare the files.
-
- find • "{filelist}" # Move to the beginning of the file list window
-
- # Loop on the filenames from the filelist.
- loop
-
- # Get the filenames in the loop variables USfile and localfile.
- # Get the US name from the filelist.
- find /•≈∞/ "{filelist}" # Get a line from filelist.
- break if `count -l "{filelist}.§"` == 0 # Exit loop if end.
- set USfile "`catenate "{filelist}.§"`"
-
- # Get the test name from the filelist.
- find /•≈∞/ "{filelist}" # Get the next line from filelist.
- set Localfile "`catenate "{filelist}.§"`"
-
- # SCM begin
-
- # Tell the user what file is being compared, and check the 'vers' resources
- # for proper format and data:
- (
- echo "============================================================================"
- echo " Master file: ∂"{USfile}∂""
- echo " CheckSum: `CheckSumTool "{USfile}"`"
- echo
- echo " Test file: ∂"{Localfile}∂""
- echo " CheckSum: `CheckSumTool "{Localfile}"`"
- echo "----------------------------------------------------------------------------"
- echo "Checking ∂'vers∂' resources in ∂"{Localfile}∂""
- IntlVersCheck "{LangCode}" "{LangInt}" "{USfile}" "{Localfile}"
- echo "============================================================================"
- ) >> "{ReportFile}"
-
- # SCM end
-
-
- #echo "{USfile}" "{Localfile}" "{rNamesFolder}" "{ReportFile}"
-
- resdiff "{USfile}" "{Localfile}" "{rNamesFolder}" "{ReportFile}" # Compare the resources. 9/1
- equal -d "{USfile}" "{Localfile}" >> "{ReportFile}" # Compare the data fork.
-
- # Add blank line to the output in between files.
- echo >> "{ReportFile}"
-
- end # End of loop on the files in the correspondence filelist.
-
- close -y "{filelist}"
-
- (
- echo
- echo "============================================================================"
- echo " End Report - `date`"
- echo "============================================================================"
- echo
- ) >> "{ReportFile}"
-
- # Now go to the top of the report window
-
- find • "{ReportFile}"
- ZoomWindow "{ReportFile}"
- save "{ReportFile}"
- open "{ReportFile}"
-
- # beep 1e,4; beep 1c,5 # Make a pleasant tone to say I'm done.
-
- Alert "The following Verifier Report was created:∂n∂n∂t" "{ReportFile}"
-
-
- # Restore shell variables and exit
-
- directory "{saveDir}" # Leave the directory setting unchanged
- set echo {saveEcho} # restore echo
- set exit "{saveExit}"
-
-
-
-